<?php
/**
 * 商品列表页控制器congcong
 */
namespace Home\Controller;
use Think\Controller;
class ListsController extends Controller
{
  
    public function index(){
       $arg['typeid']=I('get.typeid','','strip_tags');
        $arg['page']=I('get.page',1,'strip_tags');//当前页数
        $arg['brandid']=I('get.brandid','','strip_tags');
     
        $list=D('Item');
        $result=$list->index($arg);

        $this->assign('result',$result['item']);
        $this->assign('pagearr',$result['pagearr']);
        $this->assign("typeid",$arg['typeid']);
        $this->assign("brandid",$arg['brandid']);
        $this->display();
    }
    public function Search(){
      $arg['page']=I('post.page',1,'strip_tags');//当前页数
      $arg['typeid']=I('post.typeid','','strip_tags');
      $arg['brandid']=I('post.brandid','','strip_tags');
      $arg['keywords']=I('post.keywords','','strip_tags');
       $list=D('Item');
        $result=$list->index($arg);
       
        
        if(!empty($result['item']))
        {
            $result['status']=1;
          echo  json_encode($result,JSON_UNESCAPED_UNICODE);
        }else
        {
             $res['status']=0;
             $res['msg']='暂无数据';
             echo json_encode($res,JSON_UNESCAPED_UNICODE);
        }

    }
   

}